import React, { Component } from 'react'

export default class ForceUpdateCom extends Component {
  state = {
    counter: 0
  }
  render() {
    return (
      <div>
        <h1>{this.state.counter}</h1>
        <hr />
        <button onClick={() => {
          //直接修改 state 中 counter 的值
          this.state.counter += 1;
          //强制更新
          this.forceUpdate();
        }}>新增</button>
      </div>
    )
  }
}
